package cn.lunkr.sdkdemo.ui.table.fragment;


import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.Nullable;
import cn.lunkr.base.ui.BasicFragment;
import cn.lunkr.sdkdemo.R;
import cn.lunkr.sdkdemo.databinding.FragmentEmptyBinding;

public class EmptyFragment extends BasicFragment {

    private FragmentEmptyBinding mBinding;
    public static final int EMPTY_DATA = 0;
    public static final String EMPTY_TYPE = "type";

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        mBinding = FragmentEmptyBinding.inflate(inflater);
        return mBinding.getRoot();
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        initData();
    }

    private void initData() {
        if (getArguments() != null) {
            int type = getArguments().getInt(EMPTY_TYPE, -1);
            if (type == EMPTY_DATA) {
                mBinding.emptyTip.setText(R.string.empty_tip);
                mBinding.emptyIcon.setVisibility(View.GONE);
            }
        }
    }
}